﻿using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using OpenQuant;
using QuantBox;
using Skyline;
using SmartQuant;

namespace CtpseDemo
{
    public class EtfBacktestScenario : Scenario
    {
        public EtfBacktestScenario(Framework framework) : base(framework)
        {
        }

        public override void Run()
        {
            XProvider.BacktestInit();
            strategy = new Strategy(framework, "EtfTest");

            var strategy1 = new EtfTestStrategy(framework, "test");
            strategy.AddStrategy(strategy1);
            strategy1.AddInstrument(InstrumentManager["510050"]);
            BarFactory.AddQBLocalTimeBar(InstrumentManager["510050"], 86400);
            DataSimulator.DateTime1 = new DateTime(2016, 1, 1);
            DataSimulator.DateTime2 = new DateTime(2017, 1, 1);
            DataSimulator.SubscribeTrade = true;
            EventManager.Filter = new TickFilter(framework, strategy1.Instruments).DiscardEmpty().DiscardAuction();
            ExecutionSimulator.FillOnBar = false;
            ExecutionSimulator.FillOnBarOpen = false;
            ExecutionSimulator.FillMarketOnNext = true;
            ExecutionSimulator.FillLimitOnNext = true;
            StartBacktest();
        }
    }
}